/*
2GWVS a free web vulnerability scanner.
Copyright (C) 2008  Grigis Gaetan

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include "runScanner.h"
#include "webView.h"
#include "mainWindow.h"

runScanner *runScanner::_runScanner;
runScanner::runScanner(QWidget* parent,QString *url) : QWidget(parent) {
    setupUi(this);
    _runScanner=this;
    this->resize(this->maximumSize().width(),this->maximumSize().height());
    
    connect(tr_result, SIGNAL(itemClicked(QTreeWidgetItem *,int)), this, SLOT(urlItemClicked(QTreeWidgetItem *)));
    connect(tr_result, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(urlItemClicked(QTreeWidgetItem *)));
    if(url!=NULL)
        tx_url->setText(url->trimmed());
}
void runScanner::urlItemClicked(QTreeWidgetItem * item)
{
    //qDebug()<< "SIMPLETEST"+item->text(2)+"\n";
}
void runScanner::on_bt_url_clicked(){
	QUrl url(tx_url->text());
	Crawler *s=new Crawler(url,tr_result);
}
void runScanner::setLog(QString line)
{
        _runScanner->log->insertPlainText("("+QTime::currentTime().toString()+") "+line);
}
void runScanner::setPage(QUrl &url)
{
    //Useless now ...
    //MainWindow::getWebView()->setPage(url);
        //_runScanner->webView->load(url);
}
